package cn.tedu.spring.eg3;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

@Component
public class Shopcontroller {
    private String name;

    public Shopcontroller() {
        System.out.println("1.调用无参构造进行实例化");
    }
    @Value("世界那么大我想去看看")
    public void setName(String name) {
        this.name = name;
        System.out.println("2.调用set方法进行属性赋值");
    }
    @PostConstruct
   public void init(){
       System.out.println("3.执行生命周期初始化方法");
   }
    @PreDestroy
   public void destroy(){
       System.out.println("5.执行声明周期的销毁方法");
   }

}
